package com.wenzi.rule.verification.base;

import com.wenzi.rule.verification.spel.Rule;
import com.wenzi.rule.verification.spel.SpelRule;

public class RuleConfig {
    private String condition;
    private String verification;
    private String message;
    private boolean enable = true;
    private Rule rule;

    public String getCondition() {
        return condition;
    }

    public void setCondition(String condition) {
        this.condition = condition;
    }

    public String getVerification() {
        return verification;
    }

    public void setVerification(String verification) {
        this.verification = verification;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public boolean getEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public Rule getRule() {
        if (rule == null){
            rule = new SpelRule(this);
        }
        return rule;
    }

    public void setRule(Rule rule) {
        this.rule = rule;
    }

    @Override
    public String toString() {
        return "RuleConfig{" +
                "condition='" + condition + '\'' +
                ", verification='" + verification + '\'' +
                ", message='" + message + '\'' +
                ", enable=" + enable +
                ", rule=" + rule +
                '}';
    }
}
